package exploits

type Speed uint

const (
	SpeedAny Speed = iota
	SpeedSlow
	SpeedFast
)

type Registration struct {
	Name          string
	Vulnerability Vulnerability
	Speed         Speed
}

var registeredVulnerabilities []Registration

func Get(speed Speed) []Registration {
	var matched []Registration
	for _, registration := range registeredVulnerabilities {
		if speed == SpeedAny || registration.Speed == speed {
			matched = append(matched, registration)
		}
	}
	return matched
}

func register(name string, speed Speed, vulnerability Vulnerability) {
	registeredVulnerabilities = append(registeredVulnerabilities, Registration{
		Vulnerability: vulnerability,
		Speed:         speed,
		Name:          name,
	})
}
